<!--
 * @Author: your name
 * @Date: 2021-11-02 10:21:16
 * @LastEditTime: 2022-01-18 19:07:00
 * @LastEditors: Please set LastEditors
 * @Description: 艺人详情
 * @FilePath: \star-cat-h5\src\views\artist\Details.vue
-->
<template>
  <div class="details">
    <div class="head-box">
      <img class="head-box_img" :src="data.artist_avatar" />
      <div>
        <div class="head-box_name">{{ data.name }}</div>
        <div class="head-box_text">艺人评级 : {{ data.grade || "- -" }}</div>
      </div>
    </div>

    <van-cell
      class="new-cell"
      title="合约到期时间"
      :value="data.contract_end_time || '无合约'"
      is-link
    >
    </van-cell>

    <div style="margin-top: 12px">
      <van-cell title="经纪人" :value="data.agent_name" is-link> </van-cell>
      <van-cell title="星探" :value="data.star_scout_name" is-link> </van-cell>
      <van-cell title="手机号" :value="data.jm_mobile" is-link> </van-cell>
      <van-cell title="微信号" :value="data.wechat" is-link> </van-cell>
    </div>

    <div class="information-box">
      <img
        class="information-box_img"
        :src="require('../../assets/ic_zhuboxinxi.png')"
      />
      <div class="information-box_title">主播信息</div>
    </div>

    <div
      class="information-cell"
      v-for="(anchor, i) in data.anchor"
      :key="anchor.id"
    >
      <div class="information-cell_head">
        <div class="cell_head_img_box">
          <img class="cell_head_img" :src="anchor.avatar" />
          <!-- <img class="cell_head_icon" :src="anchor.platforms_path" /> -->
          <van-image
            class="cell_head_icon"
            fit="contain"
            :src="anchor.platforms_path"
          />
        </div>
        <div style="flex: 1">
          <div class="cell-name">
            {{ anchor.nick_name
            }}<label class="is_main" v-if="anchor.is_main == 1">主号</label>
          </div>
          <div class="cell-id">ID：{{ anchor.id }}</div>
          <div class="cell-date">更新时间：{{ anchor.updatetime }}</div>
        </div>
      </div>
      <div class="data-box">
        <div class="data-box_cell">
          <div class="data-box_cell_title">
            {{ anchor.incomes | formatNumber }}元
          </div>
          <div class="data-box_cell_text">30日收入</div>
        </div>
        <div class="data-box_cell">
          <div class="data-box_cell_title">{{ anchor.duration || 0 }}小时</div>
          <div class="data-box_cell_text">30日开播时长</div>
        </div>
        <div class="data-box_cell">
          <div class="data-box_cell_title">
            {{ anchor.fans_num | formatNumber }}
          </div>
          <div class="data-box_cell_text">粉丝数</div>
        </div>
      </div>

      <div class="data-cell_box" v-if="anchor.collapse">
        <van-cell
          class="data-cell"
          title="公会入驻时间"
          :value="anchor.sign_start_time"
        />
        <van-cell
          class="data-cell"
          title="公会到期时间"
          :value="anchor.sign_end_time"
        />
        <van-cell
          class="data-cell"
          title="mcn状态"
          :value="anchor.mcn_status ? '已入驻' : '未入驻'"
        />
        <van-cell
          class="data-cell"
          title="广告平台入驻"
          :value="anchor.advertising_platform"
        />
        <van-cell
          class="data-cell"
          title="直播项目"
          :value="anchor.live_name"
        />
        <van-cell
          class="data-cell"
          title="短视频项目"
          :value="anchor.fuhua_name"
        />
      </div>
      <div
        class="show-btn_box"
        @click="
          () => {
            $set(data.anchor[i], 'collapse', !anchor.collapse);
          }
        "
      >
        <img
          class="btn_box_img"
          :src="
            anchor.collapse
              ? require('../../assets/icon_zhuboxinxi_up.png')
              : require('../../assets/icon_zhuboxinxi_down.png')
          "
        />
      </div>
    </div>

    <div id="iphoneBox"></div>
    <!-- <div
      id="bottom-btn_box"
      class="bottom-box bottom-box_shadow"
      @click="edit()"
      v-if="false"
    >
      <div style="flex: 1"></div>
      <img :src="require('../../assets/ic_xiugai.png')" />
      <span>修改艺人信息</span>
      <div style="flex: 1"></div>
    </div> -->
    <div id="bottom-btn_box" class="bottom-box is_disable">
      <div style="flex: 1"></div>
      <!-- <span>审核中</span> -->
      <span v-if="data.examine_status">{{
        examine[data.examine_status - 1].status
      }}</span>
      <div style="flex: 1"></div>
    </div>

    <!-- <div id="iphoneBox"></div>
    <div id="bottom-btn_box" class="bottom-box is_disable">
      <div style="flex: 1"></div>
      <span>{{examine[data.examine_status-1].status}}</span>
      <div style="flex: 1"></div>
    </div> -->
  </div>
</template>

<script>
import { reqExamineDetail } from "@/axios/artist";
import { Toast } from "vant";
export default {
  data() {
    return {
      id: this.$route.query.id,
      data: {
        anchor: [],
      },
      examine: [
        { status: "审核中", type: "primary" },
        { status: "审核通过", type: "success" },
        { status: "已驳回", type: "danger" },
      ],
    };
  },
  created() {
    this.info();
  },
  methods: {
    info() {
      Toast.loading({
        duration: 0,
        message: "加载中...",
        overlay: true,
      });
      reqExamineDetail({ id: this.id })
        .then((res) => {
          this.data = res;
          Toast.clear();
        })
        .catch((err) => {
          Toast.clear();
          Toast.fail(err);
        });
    },
    edit() {
      this.$store.dispatch("artist/setCurrent", 0);
      this.$store.dispatch("artist/setData", this.data);
      this.$router.push("/artist_edit");
    },
  },
  mounted() {
    document.title = "艺人审核";
  },
  beforeRouteLeave(to, from, next) {
    if (to.name === "artist") {
      to.meta.keepAlive = true;
    }
    next();
  },
};
</script>

<style scoped>
.head-box {
  display: flex;
  padding: 0 15px;
  padding-top: 15px;
  padding-bottom: 20px;
  background-color: #fff;
  position: relative;
}
.head-box_img {
  width: 44px;
  height: 44px;
  border-radius: 2px;
  margin-right: 8px;
  border: none;
  /* background-color: red; */
}
.head-box_name {
  font-size: 14px;
  color: #333;
  font-weight: bold;
}
.head-box_text {
  font-size: 13px;
  color: #333;
  margin-top: 6px;
}

.new-cell::after {
  border: none;
}
.new-cell .van-cell__title {
  color: #666;
  font-size: 13px;
}
.new-cell .van-cell__value {
  font-size: 14px;
  color: #9ba1b7;
  font-weight: 400;
}
.van-cell__title {
  color: #535968;
  font-size: 13px;
}
.van-cell__value {
  font-size: 14px;
  color: #333;
  font-weight: 500;
}
.information-box {
  display: flex;
  height: 44px;
  padding: 0 15px;
  align-items: center;
  margin-top: 12px;
}
.information-box_title {
  font-size: 15px;
  color: #333;
  font-weight: 500;
}
.information-box_img {
  width: 9px;
  height: 10px;
  margin-right: 6px;
}
.information-cell {
  padding: 0 10px;
  background-color: white;
  margin-bottom: 12px;
}
.information-cell_head {
  display: flex;
  padding: 0 10px;
  padding-top: 19px;
  align-items: center;
}
.cell_head_img_box {
  width: 66px;
  height: 66px;
  position: relative;
  border-radius: 50%;
  margin-right: 22px;
}
.cell_head_img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: none;
}
.cell-name {
  font-size: 14px;
  color: #535968;
  font-weight: 500;
}
.cell-name .is_main {
  width: 36px;
  height: 10px;
  background: #f2fffe;
  border-radius: 10px;
  border: 1px solid #d6f4f3;
  font-size: 12px;
  line-height: 10px;
  padding: 0px 6px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #40dbac;
  margin-left: 8px;
}
.cell-id {
  font-size: 13px;
  color: #535968;
  font-weight: 500;
  margin-top: 5px;
}
.cell-date {
  color: #9ba1b7;
  font-size: 12px;
  margin-top: 5px;
}
.data-box {
  display: flex;
  padding-top: 30px;
}
.data-box_cell {
  flex: 1;
  text-align: center;
}
.data-box_cell_title {
  font-size: 21px;
  color: #110b32;
  font-weight: 500;
}
.data-box_cell_text {
  font-size: 13px;
  color: #9ba1b7;
  margin-top: 10px;
}
.show-btn_box {
  height: 17px;
  padding: 8px 0;
  margin-top: 5px;
  text-align: center;
}
.btn_box_img {
  width: 17px;
  height: 17px;
}

.data-cell {
  background-color: #f8fafd;
  margin-bottom: 8px;
  border-radius: 4px;
}
.data-cell::after {
  border: 0;
}
.data-cell_box {
  padding-top: 13px;
}
.data-cell .van-cell__title {
  color: #9ba1b7;
  font-size: 13px;
}
.data-cell .van-cell__value {
  color: #535968;
  font-size: 14px;
  font-weight: 500;
}
.van-cell {
  padding-right: 12px;
}
.bottom-box {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 44px;
  background-color: white;
  z-index: 10;
  line-height: 44px;
  text-align: center;
  color: #2880fb;
  font-size: 15px;
  font-weight: 500;
  display: flex;
  align-items: center;
}
.bottom-box.is_disable {
  background: #ecf4ff;
  font-size: 15px;
  font-family: PingFangSC-Medium, PingFang SC;
  font-weight: 500;
  color: #8db9ff;
}
.bottom-box img {
  width: 15px;
  height: 15px;
  margin-right: 4px;
}
.head-box::before {
  position: absolute;
  box-sizing: border-box;
  content: " ";
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background-color: #f7f7f7;
  -webkit-transform: scaleY(0.5);
  transform: scaleY(0.5);
}
.van-cell::after {
  border-color: #f7f7f7;
}
.cell_head_icon {
  position: absolute;
  width: 26px;
  height: 26px;
  /* background-color: red; */
  /* border-radius: 50%; */
  bottom: 0;
  right: -9px;
}
</style>
